def binarySearch(br, maxInitial, targetPayment):
    payment = 0
    initial = 0
    minVal = 0
    maxVal = 100
    while True:
        gm = (minVal + maxVal) / 2.0
        ## Made up for now
        initial = br["initialPayment"]
        payment = br["payment"]
        if targetPayment - payment < .01 and payment<targetPayment:
            break
        if maxInitial-initial < .01 and initial<maxInitial:
            break
        if initial > maxInitial:
            maxVal = gm
        elif targetPayment < payment:
            minVal = gm
        elif targetPayment > payment:
            maxVal = gm
    return (gm, initial, payment)

#print binarySearch(None, 15000, 850)
def newBinarySearch(maxCur, maxTest):
    minVal = 0
    maxVal = 1000
    while True:
        cur = (minVal + maxVal) / 2.0
        test = .678 *cur
        if test > maxTest or cur > maxCur:
            maxVal = cur
        elif test < maxTest:
            minVal = cur
        if cur - 
    
